@echo off
echo 正在构建和打包计件工资管理系统...

REM 设置Qt路径（根据实际安装路径修改）
set QT_PATH=D:\software\software\stuy\qt\5.15.2\mingw81_64
set PATH=%QT_PATH%\bin;%PATH%

REM 创建构建目录
if not exist "release" mkdir release

REM 构建项目
qmake oa.pro
mingw32-make release

REM 复制可执行文件到发布目录
copy release\oa.exe release\

REM 使用windeployqt部署Qt运行时库
windeployqt --release --dir release release\oa.exe

REM 复制平台插件
if exist "%QT_PATH%\plugins\platforms" (
    xcopy "%QT_PATH%\plugins\platforms" "release\platforms\" /E /I /Y
)

REM 复制其他必要插件
if exist "%QT_PATH%\plugins\imageformats" (
    xcopy "%QT_PATH%\plugins\imageformats" "release\imageformats\" /E /I /Y
)

if exist "%QT_PATH%\plugins\styles" (
    xcopy "%QT_PATH%\plugins\styles" "release\styles\" /E /I /Y
)

echo.
echo 打包完成！发布文件位于 release 目录中。
echo.
pause